const CMD_SYSTEM = {
  online: 10000,
  switch_open: 10001,
  switch_close: 10002
}

const CMD_INFRARED = {
  get_online: 1000,
  get_version: 1001,
  get_people: 1002,
  get_config: 1003,

  set_update: 1100,
  set_config: 1101,
  set_reboot: 1102
}

const CMD_DOOR = {
  get_online: 2000,
  get_version: 2001,
  get_door: 2002,
  get_config: 2003,

  set_update: 2100,
  set_config: 2101,
  set_reboot: 2102
}

const CMD_SWITCH = {
  get_online: 3000,
  get_version: 3001,
  get_switch: 3002,
  get_config: 3003,

  set_update: 3100,
  set_config: 3101,
  set_reboot: 3102,
  set_open: 3103,
  set_close: 3104
}

const CMD_MOVE = {
  stop: 199,
  get_positions: 502
}
const CMD_AXIS = [
  {
    id: 0,
    move_pos: 100,
    move_err: 110,
    stop: 150,
    set_speed: 200,
    set_pitch: 201,
    set_position: 202,
    set_run_current: 203,
    set_keep_current: 204,
    set_encoder: 205,
    get_speed: 300,
    get_pitch: 301,
    get_position: 302,
    get_run_current: 303,
    get_keep_current: 304,
    get_encoder: 305,
    get_status: 306
  },
  {
    id: 1,
    move_pos: 101,
    move_err: 111,
    stop: 151,
    set_speed: 220,
    set_pitch: 221,
    set_position: 222,
    set_run_current: 223,
    set_keep_current: 224,
    set_encoder: 225,
    get_speed: 320,
    get_pitch: 321,
    get_position: 322,
    get_run_current: 323,
    get_keep_current: 324,
    get_encoder: 325,
    get_status: 326
  },
  {
    id: 2,
    move_pos: 102,
    move_err: 112,
    stop: 152,
    set_speed: 240,
    set_pitch: 241,
    set_position: 242,
    set_run_current: 243,
    set_keep_current: 244,
    set_encoder: 245,
    get_speed: 340,
    get_pitch: 341,
    get_position: 342,
    get_run_current: 343,
    get_keep_current: 344,
    get_encoder: 345,
    get_status: 346
  },
  {
    id: 3,
    move_pos: 103,
    move_err: 113,
    stop: 153,
    set_speed: 260,
    set_pitch: 261,
    set_position: 262,
    set_run_current: 263,
    set_keep_current: 264,
    set_encoder: 265,
    get_speed: 360,
    get_pitch: 361,
    get_position: 362,
    get_run_current: 363,
    get_keep_current: 364,
    get_encoder: 365,
    get_status: 366
  }
]

const CMD_CONTROL = {
  set_reboot: 8000,

  get_pin: 1000,
  set_pin: 1001,

  get_version: 1010,
  set_version: 1011,

  get_update: 1020,
  set_update: 1021,
  get_update_percent: 1022,

  get_mqtt: 1030,
  set_mqtt: 1031,

  get_auto: 1040,
  set_auto: 1041,

  // 获取温度、湿度、压力等环境信息
  get_environment: 1050,

  // 设置修正因子
  get_factor: 1060,
  set_factor: 1061,

  get_net: 1070,
  set_net: 1071
}

module.exports = {
  CMD_INFRARED: CMD_INFRARED,
  CMD_SWITCH: CMD_SWITCH,
  CMD_DOOR: CMD_DOOR,
  CMD_MOVE: CMD_MOVE,
  CMD_AXIS: CMD_AXIS,
  CMD_CONTROL: CMD_CONTROL,
  CMD_SYSTEM: CMD_SYSTEM
}
